<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>

      function Father(uname, age) {
        this.uname = uname,
        this.age = age
      }
      //父级方法
      Father.prototype.money = function () {
        console.log('赚钱')
      }
      //子级继承父级
      function Son(uname, age) {
        Father.call(this, uname, name)
      }
       //father的实例化对象给Son
       Son.prototype=new Father()
      //指回自己
      Son.prototype.constructor= Son
      //给Son添加方法
      Son.prototype.exam=function(){
        console.log('考试')
      }
      const son=new Son('zs',18)
      const father = new Father('ls', 28)
      son.money()
      son.exam()
    </script>
  </body>
</html>
